<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class CouponResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
       $result = [
           'amount' => intval($this->amount),
           'condition_amount' => intval($this->condition_amount),
           'expired_time' => !empty($this->expired_time) ? date('Y-m-d', $this->expired_time) : null,
           'status' => $this->status,
       ];

       return $result;
    }
}
